Package edu.claflin.finder.logic
Class Edge
java.lang.Object
edu.claflin.finder.logic.Edge
Represents an Edge in memory. A simple implementation requiring only two
nodes and a single piece of edge data.
- Version:
- 3.1 February 2, 2016
- Author:
- Charles Allen Schultz II
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAttempts to duplicate an Edge based on the supplied parameters.booleandoublegetData()Access method for the Edge's data (such as weight).Access method for the Edge's source.Access method for the Edge's target.inthashCode()booleanDetermines whether the given Node is involved in the Edge.booleanAccess method for the Edge's undirectedness parameter.voidAccess method for the Edge's data (such as weight).voidsetUndirected(boolean undirected) Access method for the Edge's undirectedness parameter.toString()
-
Field Details
-
source
The node representing the source. -
target
The node representing the target. -
data
private double dataThe data attached to the edge. -
undirected
private boolean undirectedIndicates if this edge should be treated as being undirected.
-
-
Constructor Details
-
Edge
Initializes the Edge object.- Parameters:
source- the Node representing the interaction source.target- the Node representing the interaction target.data- the Object representing the Edge data.undirected- the boolean indicating if this edge is undirected.
-
-
Method Details
-
getSource
Access method for the Edge's source.- Returns:
- the Node representing the source.
-
getTarget
Access method for the Edge's target.- Returns:
- the Node representing the target.
-
getEndpoints
-
getOther
-
getData
public double getData()Access method for the Edge's data (such as weight).- Returns:
- the Object representing the data.
-
setData
Access method for the Edge's data (such as weight).- Parameters:
data- the new data for the edge.
-
isUndirected
public boolean isUndirected()Access method for the Edge's undirectedness parameter.- Returns:
- the boolean indicating if this edge is undirected.
-
setUndirected
public void setUndirected(boolean undirected) Access method for the Edge's undirectedness parameter.- Parameters:
undirected- a boolean indicating if this edge should be undirected.
-
includes
Determines whether the given Node is involved in the Edge.- Parameters:
n- the Node to verify is in the Edge- Returns:
- whether the given Node is involved in the Edge
-
duplicate
Attempts to duplicate an Edge based on the supplied parameters. The data attached to the edge REMAINS THE SAME OBJECT as the original graph. As such, non-immutable objects will reflect changes across both edges. The supplied Node objects must be equivalent to the old ones.- Parameters:
source- the new Source node reference to utilize.destination- the new Destination node reference to utilize.- Returns:
- a duplicate Edge decoupled from the original Graph.
-
equals
-
hashCode
public int hashCode() -
toString
-